Toy Storage
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 4588
Accepted: 2718
DescriptionMom and Dad had a problem:their child, Reza, never puts his toys away when he was finished playing with them. They gave Reza a rectangular box to put he toys in. Unfortunately, Reza is rebellious and obeys he parents by simply
Toy Storage
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 6534
Accepted: 3905
DescriptionMom and Dad had a problem:their child, Reza, never puts his toys away when he was finished playing with them. They gave Reza a rectangular box to put he toys in. Unfortunately, Reza is rebellious and obeys he parents by simply throwing he toys
Toy Storage
Time Limit: 1000MS
Memory Limit: 65536K
DescriptionMom and Dad had a problem:their child, Reza, never puts his toys away when he was finished playing with them. They gave Reza a rectangular box to put he toys in. Unfortunately, Reza is rebellious and obeys he parents by simply throwing he toys into the box. All the toys get mixed up, and it's impossible for
It is exactly the same as 2318. The only difference is that the data is sorted and the output data is the statistical data.
The method is still the same as binary + cross product.Toy storage
Time limit:1000 ms
Memory limit:65536 K
Total submissions:2491
Accepted:1427
DescriptionMom and dad have a problem: their child, Reza, never puts his toys away when he is finished playing with them. they gave Reza a rectangula
http://poj.org/problem?id=2398This problem and the previous toys is the same is the output is not the same as this gives is the chaos you have to sort the bezel first#include #include#include#include#include#include#include#include#includeusing namespacestd;#defineMemset (A, B) memset (A,b,sizeof (a))#defineN 5500typedefLong Longll;structnode{intx, Y, V;} P[n],u[n];intY2;intcmpConst void*a,Const void*b) { structNode *c, *F; C=(structNode *) A; F=(structNode *) b; returnC->x-f->x;}intFind (int
, E; the intN, M; the intTMP[MAXM]; the intANS[MAXM];94 the intOK (point P, line L) { theRT ((L.B.Y-L.A.Y) * (p.x-l.a.x)-(P.Y-L.A.Y) * (l.b.x-l.a.x)); the }98 About BOOLCMP (line A, line B) { - if(A.A = = B.A)returnA.B b.b;101 returnA.A B.A;102 }103 104 intMain () { the //FRead ();106 intx1, x2;107 BOOLFlag =1;108 while(~rint (n) N) {109 Cls (TMP); Cls (ans); the Rint (m); Rint (s.x); Rint (S.Y); Rint (e.x); Rint (E.Y);111 Rep (i, n) { the Rint (x1); Rint (x2);113Line[
/* Poj 2398 Toy storage is basically the same as 2318, but requires that the number of T toys be output t from small to large. Note that the sequence of the baffle is not from left to right. order, the calculation ry that needs to be sorted is that the range of a rectangle is divided into n + 1 regions by N line segments, and then there are m coordinate points, they belong to the region where they are locat
The computational geometry finally opened the hole ...Cross product + two points.#include #include#include#include#defineMAXN 5050using namespacestd;structpoint{intx, y; Point (intXinty): x (x), Y (y) {} point () {} friend pointoperator-(point X,point y) {returnPoint (x.x-y.x,x.y-y.y); }}P[MAXN];structline{Point X,dt; Line (point X,point DT): X (x), dt (DT) {} line () {} friendint operator*(line X,line y) {returnx.dt.x*y.dt.y-y.dt.x*X.dt.y; }}L[MAXN];intn,m,cnt[maxn],x1,y1,x2,y2,x,y;BOOLCheckint
box. Even if Reza keeps throwing his toys to the box, at least toys, then get thrown into different partitions stay separate. The box looks like this from the top:
We want for each positive integer t, such this there exists a partition with T-toys, determine how many partitions has T, Toys.InputThe input consists of a number of cases. The first line consists of six integers n, m, x1, y1, x2, y2. The number of Cardboards to form the partitions is n (0 A line consisting of a single 0 termin
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.